home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / hex / mainfrm.frm < prev    next >
Text File  |  1999-10-12  |  11KB  |  428 lines

  1. VERSION 4.00
  2. Begin VB.Form mainfrm 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "HEX Guru v1.0"
  5.    ClientHeight    =   2730
  6.    ClientLeft      =   1410
  7.    ClientTop       =   1770
  8.    ClientWidth     =   5640
  9.    Height          =   3135
  10.    Left            =   1350
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    MousePointer    =   1  'Arrow
  15.    ScaleHeight     =   182
  16.    ScaleMode       =   3  'Pixel
  17.    ScaleWidth      =   376
  18.    ShowInTaskbar   =   0   'False
  19.    Top             =   1425
  20.    Width           =   5760
  21.    Begin VB.CommandButton cmdcopy 
  22.       Caption         =   "Copy HEX"
  23.       Height          =   255
  24.       Left            =   1440
  25.       TabIndex        =   15
  26.       Top             =   1440
  27.       Width           =   1215
  28.    End
  29.    Begin VB.OptionButton opt2 
  30.       Caption         =   "Back color"
  31.       Height          =   255
  32.       Left            =   4440
  33.       TabIndex        =   9
  34.       Top             =   2400
  35.       Width           =   1095
  36.    End
  37.    Begin VB.OptionButton opt1 
  38.       Caption         =   "Text color"
  39.       Height          =   255
  40.       Left            =   4440
  41.       TabIndex        =   8
  42.       Top             =   2160
  43.       Value           =   -1  'True
  44.       Width           =   1095
  45.    End
  46.    Begin VB.HScrollBar bluescroll 
  47.       Height          =   255
  48.       Left            =   720
  49.       Max             =   255
  50.       TabIndex        =   4
  51.       Top             =   2400
  52.       Width           =   1575
  53.    End
  54.    Begin VB.HScrollBar greenscroll 
  55.       Height          =   255
  56.       Left            =   720
  57.       Max             =   255
  58.       TabIndex        =   3
  59.       Top             =   2160
  60.       Width           =   1575
  61.    End
  62.    Begin VB.HScrollBar redscroll 
  63.       Height          =   255
  64.       Left            =   720
  65.       Max             =   255
  66.       TabIndex        =   2
  67.       Top             =   1920
  68.       Width           =   1575
  69.    End
  70.    Begin VB.TextBox maintext 
  71.       Height          =   2295
  72.       Left            =   2760
  73.       MultiLine       =   -1  'True
  74.       TabIndex        =   0
  75.       Text            =   "mainfrm.frx":0000
  76.       Top             =   360
  77.       Width           =   2775
  78.    End
  79.    Begin VB.Line Line1 
  80.       X1              =   8
  81.       X2              =   192
  82.       Y1              =   24
  83.       Y2              =   24
  84.    End
  85.    Begin VB.Label Label7 
  86.       Caption         =   "HEX Guru v1.0"
  87.       Height          =   195
  88.       Left            =   120
  89.       TabIndex        =   18
  90.       Top             =   120
  91.       Width           =   1785
  92.    End
  93.    Begin VB.Label Label6 
  94.       Caption         =   "Written by Etienne Blythe"
  95.       Height          =   195
  96.       Left            =   120
  97.       TabIndex        =   17
  98.       Top             =   720
  99.       Width           =   1785
  100.    End
  101.    Begin VB.Label Label1 
  102.       Caption         =   "http://stormloader.com/nearworlds"
  103.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  104.          Name            =   "MS Sans Serif"
  105.          Size            =   8.25
  106.          Charset         =   0
  107.          Weight          =   400
  108.          Underline       =   -1  'True
  109.          Italic          =   0   'False
  110.          Strikethrough   =   0   'False
  111.       EndProperty
  112.       ForeColor       =   &H00FF0000&
  113.       Height          =   195
  114.       Left            =   120
  115.       TabIndex        =   16
  116.       Top             =   960
  117.       Width           =   2460
  118.    End
  119.    Begin VB.Label hextext 
  120.       Caption         =   "#000000"
  121.       Height          =   255
  122.       Left            =   600
  123.       TabIndex        =   14
  124.       Top             =   1440
  125.       Width           =   735
  126.    End
  127.    Begin VB.Label Label5 
  128.       AutoSize        =   -1  'True
  129.       Caption         =   "HEX:"
  130.       Height          =   195
  131.       Left            =   120
  132.       TabIndex        =   13
  133.       Top             =   1440
  134.       Width           =   375
  135.    End
  136.    Begin VB.Label bluetext 
  137.       Alignment       =   1  'Right Justify
  138.       Caption         =   "255"
  139.       Height          =   255
  140.       Left            =   2400
  141.       TabIndex        =   12
  142.       Top             =   2400
  143.       Width           =   255
  144.    End
  145.    Begin VB.Label greentext 
  146.       Alignment       =   1  'Right Justify
  147.       Caption         =   "255"
  148.       Height          =   255
  149.       Left            =   2400
  150.       TabIndex        =   11
  151.       Top             =   2160
  152.       Width           =   255
  153.    End
  154.    Begin VB.Label redtext 
  155.       Alignment       =   1  'Right Justify
  156.       Caption         =   "255"
  157.       Height          =   255
  158.       Left            =   2400
  159.       TabIndex        =   10
  160.       Top             =   1920
  161.       Width           =   255
  162.    End
  163.    Begin VB.Label Label4 
  164.       AutoSize        =   -1  'True
  165.       Caption         =   "Blue:"
  166.       Height          =   195
  167.       Left            =   120
  168.       TabIndex        =   7
  169.       Top             =   2400
  170.       Width           =   360
  171.    End
  172.    Begin VB.Label Label3 
  173.       AutoSize        =   -1  'True
  174.       Caption         =   "Green:"
  175.       Height          =   195
  176.       Left            =   120
  177.       TabIndex        =   6
  178.       Top             =   2160
  179.       Width           =   480
  180.    End
  181.    Begin VB.Label Label2 
  182.       AutoSize        =   -1  'True
  183.       Caption         =   "Red:"
  184.       Height          =   195
  185.       Left            =   120
  186.       TabIndex        =   5
  187.       Top             =   1920
  188.       Width           =   345
  189.    End
  190.    Begin VB.Label Lable1 
  191.       AutoSize        =   -1  'True
  192.       Caption         =   "Sample text:"
  193.       Height          =   195
  194.       Left            =   2760
  195.       TabIndex        =   1
  196.       Top             =   120
  197.       Width           =   870
  198.    End
  199. End
  200. Attribute VB_Name = "mainfrm"
  201. Attribute VB_Creatable = False
  202. Attribute VB_Exposed = False
  203.  
  204. Private Sub bluescroll_Change()
  205. If opt1.Value = True Then
  206. maintext.ForeColor = RGB(redscroll.Value, greenscroll.Value, bluescroll.Value)
  207. redtext = redscroll.Value
  208. greentext = greenscroll.Value
  209. bluetext = bluescroll.Value
  210. textred = redscroll.Value
  211. textgreen = greenscroll.Value
  212. textblue = bluescroll.Value
  213. ElseIf opt2.Value = True Then
  214. maintext.BackColor = RGB(redscroll.Value, greenscroll.Value, bluescroll.Value)
  215. redtext = redscroll.Value
  216. greentext = greenscroll.Value
  217. bluetext = bluescroll.Value
  218. backred = redscroll.Value
  219. backgreen = greenscroll.Value
  220. backblue = bluescroll.Value
  221. End If
  222.  
  223.     Dim lCol As Long
  224.     Dim iRed, iGreen, iBlue As Integer
  225.     Dim vHexR, vHexG, vHexB As Variant
  226.     'Break out the R, G, B values from the common dialog color
  227.     lCol = lCdlColor
  228.     iRed = redscroll.Value Mod &H100
  229.     lCol = lCol \ &H100
  230.     iGreen = greenscroll.Value Mod &H100
  231.     lCol = lCol \ &H100
  232.     iBlue = bluescroll.Value Mod &H100
  233.     
  234.     'Determine Red Hex
  235.     vHexR = Hex(iRed)
  236.  
  237.  
  238.     If Len(vHexR) < 2 Then
  239.         vHexR = "0" & vHexR
  240.     End If
  241.  
  242.     'Determine Green Hex
  243.     vHexG = Hex(iGreen)
  244.  
  245.  
  246.     If Len(vHexG) < 2 Then
  247.         vHexG = "0" & iGreen
  248.     End If
  249.  
  250.     'Determine Blue Hex
  251.     vHexB = Hex(iBlue)
  252.  
  253.  
  254.     If Len(vHexB) < 2 Then
  255.         vHexB = "0" & vHexB
  256.     End If
  257.  
  258.     'Add it up, return the function value
  259.     hextext.Caption = "#" & vHexR & vHexG & vHexB
  260.  
  261. End Sub
  262.  
  263. Private Sub cmdcopy_Click()
  264. Clipboard.SetText hextext.Caption
  265. maintext.Text = "HEX copied!"
  266. End Sub
  267.  
  268. Private Sub Form_Load()
  269. Static textred, textgreen, textblue
  270. Static backred, backgreen, backblue
  271. textred = 0
  272. textgreen = 0
  273. textblue = 0
  274. backred = 0
  275. backgreen = 0
  276. backblue = 0
  277. End Sub
  278.  
  279.  
  280. Private Sub greenscroll_Change()
  281. If opt1.Value = True Then
  282. maintext.ForeColor = RGB(redscroll.Value, greenscroll.Value, bluescroll.Value)
  283. redtext = redscroll.Value
  284. greentext = greenscroll.Value
  285. bluetext = bluescroll.Value
  286. textred = redscroll.Value
  287. textgreen = greenscroll.Value
  288. textblue = bluescroll.Value
  289. ElseIf opt2.Value = True Then
  290. maintext.BackColor = RGB(redscrol